package com.sinothk.dialog.demo.centerDialog;

import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.jiangyy.easydialog.CommonDialog;
import com.jiangyy.easydialog.InputDialog;
import com.sinothk.dialog.demo.R;

public class CenterDialogDemoMainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 弹出对话框！
        setContentView(R.layout.activity_center_dialog_demo_main);
    }

    public void okDialog(View view) {
        new CommonDialog.Builder(this)
                .setCancelable(false)
                .setTitle("重新登录")
                .setMessage("登录已过期, 确定重新登录吗？")
                .setPositiveButton("重新登录", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                    }
                })
                .setNegativeButton("退出", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                    }
                })
                .show();
    }

    public void dialog2(View view) {
        new InputDialog.Builder(this)
                .setTitle("请输入")
                .setHint("这里是提示内容")
                .setLines(1)
                .setPositiveButton("确定", new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Toast.makeText(CenterDialogDemoMainActivity.this, view.getTag().toString(), Toast.LENGTH_SHORT).show();
                    }
                }).setNegativeButton("取消", null).show();
    }
}
